This repository has no description
semble
/
src
/
webapp
/
app
/
(dashboard)
/
profile
/
[handle]
/
(withoutHeader)
/
collections
/
[collectionId]
/
layout.tsx
990 B
40 lines
1import { ApiClient } from '@/api-client/ApiClient';
2import Header from '@/components/navigation/header/Header';
3import { createClientTokenManager } from '@/services/auth';
4import type { Metadata } from 'next';
5import { Fragment } from 'react';
6
7interface Props {
8 params: Promise<{ collectionId: string }>;
9}
10
11export async function generateMetadata({ params }: Props): Promise<Metadata> {
12 const { collectionId } = await params;
13
14 const apiClient = new ApiClient(
15 process.env.NEXT_PUBLIC_API_BASE_URL || 'http://localhost:3000',
16 createClientTokenManager(),
17 );
18
19 const collection = await apiClient.getCollectionPage(collectionId);
20
21 return {
22 title: collection.name,
23 description:
24 collection.description ??
25 `View ${collection.author.name}'s collection on Semble`,
26 };
27}
28
29interface Props {
30 children: React.ReactNode;
31}
32
33export default function Layout(props: Props) {
34 return (
35 <Fragment>
36 <Header />
37 {props.children}
38 </Fragment>
39 );
40}